The mission/role of OS OPERATING-SYSTEM OPERATIONS
Operating-System Operations
• Driven model of operating system
• Hardware protection
• Process management
• Memory management
• Storage management
• I/O Subsystem
Interrupt driven operations
- Interrupt driven by hardware
Hardware Protection
- Prevent errors and misuse
- Dual-Mode Operations – a mode bit
- User mode
- Kernel mode
@ System call
就像是系統提供的函式庫供使用者做些事情
每個 System call 都對應到不同代號
changes mode to kernel, return from
call resets it to user
@ API
更方便 "間接" 的操作系統
比 System call 更高一層(能夠可攜化,在不同OS使用)
Timer control
prevent infinite loop / process hogging resources
比較 :
//=========================
- Interrupt : 避免發生例外情況
- Timer : 預防程式長期佔有某項資源(定期call Interrupt)
//=========================
Process Management
程序執行結束回收資源
任何一個"緒"都有一個 program counter 算現在執行到哪裡了
當一個Process就能接續下一個
- program : 被動的程序單元
- process : 主動的程序單元
// A life cycle of process //
• Services
• Creating and deleting both user and system processes
• Suspending and resuming processes (ch5)
• Providing mechanisms for process synchronization (ch6)
• Providing mechanisms for process communication (ch4)
• Providing mechanisms for deadlock handling (ch7)
Memory Management
CPU最遠只能管到記憶體,所以資料要先load進記憶體,
這就是Memory Management要處理的事情
• Services
• Memory usage and availability
• Decision of memory assignment
• Memory allocation and de-allocation
Storage Management
OS provides a logical storage unit: File
• Services
• File creation and deletion
• Directory creation and deletion
• Primitives for file and directory manipulation
• Mapping of files onto secondary storage
• Backing up files on stable (non-volatile) storage media
I/O Subsystem (ch13)
I/O工作範圍廣泛,所以OS於kernal另設置kernal I/O Subsystem
buffering(緩衝器), caching, and spooling(序列緩衝器) system
User Privilege權限
-rwxr--r--
user /group /other